package com.miyake.dsp.converter.ui;

import com.miyake.dsp.converter.DigitizerSetting;
import com.miyake.dsp.ui.DspTextField;
import com.miyake.dsp.ui.DspWidget;

public class DigitizerSettingUI extends DspWidget{
	private DigitizerSetting setting;

	public DigitizerSettingUI(DigitizerSetting setting) {
		this.setting = setting;
		createThreshold();
	}
	
	private void createThreshold() {
		DspTextField text = new DspTextField("Threshold");
		text.setValue(String.valueOf(setting.getThreshold()));
		this.add(text);
		
		text.addHandler(new DspWidgetHandler() {
			@Override
			public void onChange(String value) {
				setting.setThreshold(Double.valueOf(value));
				fireChange(value);
			}
		});	
	}
}
